package com.blb.community_admin.entity;


import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * @author hkp
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysOperLog {
    @TableId(type = IdType.AUTO)
    @ExcelProperty("日志主键")
    private long operId;
    @ExcelProperty("模块标题")
    private String title;
    @ExcelProperty("业务类型（0其它 1新增 2修改 3删除）")
    private long businessType;
    @ExcelProperty("方法名称")
    private String method;
    @ExcelProperty("请求方式")
    private String requestMethod;
    @ExcelProperty("操作类别（0其它 1后台用户 2手机端用户）")
    private long operatorType;
    @ExcelProperty("操作人员")
    private String operName;
    @ExcelProperty("部门名称")
    private String deptName;
    @ExcelProperty("请求URL")
    private String operUrl;
    @ExcelProperty("主机地址")
    private String operIp;
    @ExcelProperty("操作地点")
    private String operLocation;
    @ExcelProperty("请求参数")
    private String operParam;
    @ExcelProperty("返回参数")
    private String jsonResult;
    @ExcelProperty("操作状态（0正常 1异常）")
    private long status;
    @ExcelProperty("错误消息")
    private String errorMsg;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ExcelProperty("操作时间")
    private LocalDateTime operTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SysOperLog that = (SysOperLog) o;
        return Objects.equals(operName, that.operName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(operName);
    }
}
